Repository navigation
fix(daemon): apply stored runtime hints only to the app they were set for - #5010
Conversation
… for An open with --metro-port, --metro-host, --bundle-url or --launch-url stored the hints for the session without the app they were for. Every later open without runtime flags re-applied them to whatever app it opened: on Android the run-as write into a non-debuggable app such as Photos or the launcher failed the open, and on an iOS simulator it wrote RCT_jsLocation into the other app's defaults and followed up with the first app's launch URL. The session store now binds stored hints to the app an open applied them to. A later open without runtime flags applies them only when it opens that app; another app opens without them. Hints stored before any open bind to the first app that applies them, and runtime set keeps the binding.
Opening another app no longer re-applies stored hints, so the session app moves on while the hints stay bound to the first app. Every clear path still targeted the session's current app: close, runtime clear, daemon shutdown and idle expiry, and an open with flags but no Metro address. On Android the clear then missed the app that held debug_http_host. Each path now clears the app the stored hints are bound to and falls back to the session app for unbound hints. The session store returns the hints with their app, and the lifecycle finalization takes the clear input with its app id.
|
Thanks for the fix. The code at 91761f6 is ready: stored runtime hints now apply only to the app they were bound to. The Smoke Tests failure is most likely unrelated, because it stops in the Linux desktop dependencies step when apt-get update times out, before any agent-device code runs. There are no conflicts. Before merge, re-run the Smoke Tests job and the cancelled Body rules checks. Not verified here: this PR's own Smoke Tests log, a live iOS simulator run, and the new tests against the base commit. Not blocking, and fine to take or leave: the filter at https://github.com/callstack/agent-device/blob/91761f6/packages/daemon/src/sessions/session-lifecycle/internal/session-open-prepare.ts#L225 could drop hints on a re-open if pre-open resolution differs from the open outcome id, so the stored binding and the compared id should come from one resolution; opening app B with new explicit transport hints while hints are bound to app A leaves A's native hints written (https://github.com/callstack/agent-device/blob/91761f6/packages/daemon/src/sessions/session-runtime.ts#L364), which predates this PR and suits a follow-up issue; and SessionStore now has both getRuntimeHints and getStoredRuntimeHints for one map, which could be one accessor. |
Summary
Stored runtime hints are now bound to the app an
openapplied them to. A lateropenwithout runtime flags re-applies them only to that app. Before, every lateropenin the session re-applied them to whatever it opened. On Android, opening a non-debuggable app (Photos, Files, the launcher) failed at therun-aswrite. On an iOS simulator,RCT_jsLocationwas written into the other app's defaults, and the first app's launch URL was re-opened. Hints stored before anyopenbind to the first app;runtime setkeeps the binding.close,runtime clear, and expiry clear them from the app they're bound to.Before / after
Pixel 9 AVD (Android 16), with a debuggable React Native app (
<rn-app>):Validation
91761f668,check:affected --run --head,exactCommit: true. Format, lint, typecheck, layering, fallow, build and vitest-related pass.unitfails only onupload-http-deadlineandcommitted-source-tree, which fail the same way on clean main on this macOS host.command-docs,doc-linksanddoc-prosepass when run directly.session-open-runtime.test.tsfail without the fix (apply and clear paths).Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.